<HTML><HEAD><TITLE>checklist(+Pred, +List)</TITLE>
</HEAD><BODY>[ <A HREF="index.html">library(lists)</A> | <A HREF="../../index.html">Reference Manual</A> | <A HREF="../../fullindex.html">Alphabetic Index</A> ]
<H1>checklist(+Pred, +List)</H1>
Succeeds if Pred(Elem) succeeds for every element of List.


<DL>
<DT><EM>+Pred</EM></DT>
<DD>Atom or compound term.
</DD>
<DT><EM>+List</EM></DT>
<DD>List.
</DD>
</DL>
<H2>Description</H2>
   checklist/3 succeeds if for every element of List, the invocation of
   Pred with one aditional argument which is this element succeeds.
<P>
   The definition of this Prolog library predicate is:
<PRE>
:- tool(checklist/3, checklist_body/4).

checklist_body(_, [], _).
checklist_body(Pred, [Head|Tail], M) :-
    Pred =.. PL,
    append(PL, [Head], NewPred),
    Call =.. NewPred,
    call(Call, M),
    checklist_body(Pred, Tail, M).
</PRE>
   This predicate does not perform any type testing functions.
	
<H3>Modules</H3>
This predicate is sensitive to its module context (tool predicate, see @/2).
<H3>Fail Conditions</H3>
Fails if at least for one element of List the invocation of Pred with this additional argument fails.
<H3>Resatisfiable</H3>
Resatisfiable if at least for one element of List the invocation of Pred with this additional argument is resatisfiable.
<H2>Examples</H2>
<PRE>
Success:
  checklist(integer, [1, 3, 5]).
  checklist(spy, [var/1, functor/3]).

Fail:
  checklist(current_op(_, _), [+, -, =]).
  (fails because the precedence of = does not match that of +)



</PRE>
<H2>See Also</H2>
<A HREF="../../lib/lists/maplist-3.html">maplist / 3</A>
</BODY></HTML>
